package com.simplenix.rush.db.comparators;

import com.simplenix.rush.db.Note;
import net.sourceforge.floggy.persistence.Comparator;
import net.sourceforge.floggy.persistence.Persistable;

/**
 *
 * @author Carol
 */
public class NoteNameComparator implements Comparator {

    public int compare(Persistable note0, Persistable note1) {
        String name0 = ((Note) note0).getName();
        String name1 = ((Note) note1).getName();
        if (name0.compareTo(name1) == 0) {
            return EQUIVALENT;
        } else if (name0.compareTo(name1) > 0) {
            return FOLLOWS;
        } else {
            return PRECEDES;
        }
    }
}
